package com.healthcloud.dao;

import org.apache.ibatis.annotations.Param;

import com.healthcloud.entity.Condition;
import com.healthcloud.utils.PageParam;
import com.healthcloud.utils.Pagine;

import java.io.Serializable;
import java.util.List;

/**
 * Created by xiam on 2015/6/19.
 */
public interface CRUDMapper<T, ID extends Serializable> {

	T get(@Param("id") ID id);

	List<T> getByIds(@Param("ids") ID[] ids);

	List<T> findByEntity(@Param("entity") T entity, @Param("page") Pagine<T> pagine);

	List<T> findByEntityAll(@Param("entity") T entity);

	//xiami
	List<T> criteriaSearch(@Param("conditions") List<Condition<Object>> conditions,
                           @Param("page") Pagine<T> pagine);

	//hxh
	List<T> search(@Param("entity") T entity, @Param("pageParam")PageParam pageParam);

	int count(@Param("entity") T entity);

	int save(@Param("entity") T entity);

	int saveBatch(@Param("entities") List<T> entities);

	int update(@Param("entity") T entity);

	int delete(@Param("id") ID id);

	int deleteBatch(@Param("ids") ID[] ids);

	int logicalDelete(@Param("id") ID id);
	/**
	 * 自定义where条件
	 * @param whereCondition
	 * @return
	 */
	List<T> customCondition(@Param("whereCondition") String whereCondition);
}
